<script src="../../../../../../public/static/global/My97DatePicker/WdatePicker.js"></script>
{extend name="$BASE_POPUP_FORM" /}
{block name="body"}
<link rel="stylesheet" type="text/css" href="__STATIC__/easyui/themes/custom/easyui.css" />
<style>
    .edui-editor, .edui-editor-iframeholder {
        width: 790px !important;
    }
    .img_upload_wrp .img_upload_box.img_upload_preview_box{
        width:120px !important;
        height:120px !important;
    }
    .tab-panel .html-content{height: 520px}
</style>
<div id="js_tab" class="tab-panel">
    <ul class="tab-header">
        <li class="tab-item current" data-tag="0">基础信息</li>
    </ul>
    <div class="tab-content">
        <div id="js_div0" class="html-content" >
            <input type="hidden" id="id" name="id" value="{$id}"/>
            <input type="hidden" id="news_json" name="news_json" />
            <div class="control-row col-2">
                <div class="control-group">
                    <label class="control-label">公告标题</label>
                    <div class="controls">
                        <input type="text" style="width:300px" id="title" name="title" placeholder="输入标题" class="form-control required" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">语言类型</label>
                    <div class="controls">
                        <select name="lang" id="lang" class="form-control">
                            <option value="0">中文</option>
                            <option value="1">英文</option>
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">是否发布</label>
                    <div class="controls">
                        <select name="status" id="is_public" class="form-control">
                            <option value="0">否</option>
                            <option value="1">是</option>
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">公告位置</label>
                    <div class="controls">
                        <select name="type" id="type" class="form-control">
                            <option value="1">普通公告</option>
                            <option value="2">新手指南</option>
                            <!-- <option value="3">置顶头条</option> -->
                            <!-- <option value="4">通知</option> -->
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">发布时间</label>
                    <div class="controls">
                        <input type="text" id="update_time" name="update_time" class="form-control" />
                    </div>
                </div>


            </div>

            <!-- <div class="control-group">
                <label class="control-label">
                    LOGO
                </label>
                <div class="controls">
                    <div id="js_upload_wrp">
                        <input type="hidden" id="images" name="images" value="" class="" />
                        {:hook('picResource',array('name'=>'images','limit_num'=> '5','checktype'=>1,'folder'=>'category','tips'=>'建议尺寸：800x600像素。仅支持.jpg .png格式长方形照片。','callback'=>'uploadImagesCallback'))}
                    </div>
                </div>
            </div> -->
            <div class="control-group">
                <label class="control-label">公告内容</label>
                <div class="controls">
                    <textarea id="content" name="content"></textarea>
                    {:hook('editor', array('height'=>'','id'=>"$id",'name'=>'content'))}
                </div>
            </div>
        </div>

    </div>
</div>


{/block}
{block name="script"}
<script type="text/javascript" src="__STATIC__/layer/laydate/laydate.js"></script>
<script type="text/javascript">
    /**
     * 点击图片删除
     * */
    $('#js_upload_wrp').on("click", ".js_delete", function (e) {
        var _this = $(this);
        _this.parents(".js_edit_pic_wrp").remove();
        // setPicValue()
    });
    /**
     * 添加图片
     */
    // function uploadImagesCallback(data) {
    //     $("#images").val(data);
    //     // setPicValue("images",data);
    // }

    function openSearchWin(){
        var url = getURL('author/select_author','','news');
        openBarWinParent('选择用户', 500, 600, url, function (data) {
            $("#author_id").setValue(data);
        }, ['选定', '取消']);
    }

    $("#js_tab .tab-item").click(function () {
        var tag = $(this).data("tag");
        switchTab(tag);
    });

    //发布时间插件
    laydate.render({
        elem: '#update_time'
        , type: 'datetime'
    });
    //上传回调
    function uploadImgCallback(data) {
        $("#images").val(data)
        var arr = data.split(',')
        for (var i in arr) {
            appendPic('pic', arr[i])
        }
    }


    function onLoadDataSuccess(data)
    {

        if (typeof (onLoadSuccess) !== "undefined")
            onLoadSuccess();

        // setPicValue("images", data['images']);
        // if (data.images) {
        //     var images = data.images;
        //     var arr = images.split(',');
        //     for (var i = 0; i < arr.length; i++) {
        //         var html = '<img  style="width:150px;height:150px;padding:5px;" src="'+arr[i]+'" alt="">';
        //         $("#js_append_img").append(html);
        //     }
        // }
    }

    function insertImageCallback(data){
        var src = data[0].src;
        var html = '<img  style="width:150px;height:150px;padding:5px;" src="'+src+'" alt="">';
        $("#js_append_img").append(html);
        var images = $("#images").val();
        if(images){
            images += ',' + src;
        }else{
            images = src;
        }
        $("#images").val(images);
    }






</script>
{/block}


